package com.roshan.web.dto;

@SuppressWarnings("nls")
public enum WSCommunicationStatus {

    /**
     * Success Status.
     */
    SUCCESS("Success", 100),

    /**
     * Unrecoverable Error.
     */
    ERROR("Error", 500),

    /**
     * Error in token generation.
     */
    ERROR_IN_CHECKOUT_TOKEN_GEN("Error in token generation", 501),

    /**
     * Data access Error.
     */
    DATA_ACCESS_ERROR("Data access error", 555),

    /**
     * Customer not found error.
     */
    CUSTOMER_NOT_FOUND("Customer Not Found", 543),

    /**
     * General Failure Occurred. Does not know the cause.
     */
    FAILED("Failed", 400),

    /**
     * Merchant URI invalid.
     */
    INVALID_MERCHANT_URI("Invalid merchant uri", 401),

    /**
     * Merchant URI is empty.
     */
    EMPTY_MERCHANT_URI("Empty merchant uri", 402),

    /**
     * Arguments specified are not valid.
     */
    INVALID_ARGUMENTS("Invalid arguments", 403),

    /**
     * Store location URI provided is Empty.
     */
    EMPTY_STORELOCATION_URI("Empty store location uri", 404),

    /**
     * Empty terminal ID list.
     */
    EMPTY_TERMINAL_ID_LIST("Empty terminal list", 405),

    /**
     * The store location URI is not valid.
     */
    INVALID_STORELOCATION_URI("Invalid store location uri", 406),

    /**
     * Merchant is not present in the system. Merchant is not registered.
     */
    MERCHANT_NOT_PRESENT("Merchant not presnt", 407),

    /**
     * The checkout token is not valid.
     */
    INVALID_CHECKOUT_TOKEN("Invalid checkout token", 408),

    /**
     * Merchant already exists.
     */
    MERCHANT_ALLREADY_EXISTS("Merchant already exsists", 409),

    /**
     * Empty terminal ID.
     */
    EMPTY_TERMINAL_ID("Empty terminal id", 410),

    /**
     * Store location not present.
     */
    STORE_LOCATION_NOT_PRESENT("Store location not present", 411),

    /**
     * Merchant Authentication Failed.
     */
    MERCHANT_AUTH_FAILED("Merchant authentication failed", 412),

    /**
     * Timeout of Transaction confirmation for merchant.
     */
    MERCHANT_TRANSACTION_CONFIRMATION_TIMEOUT("Merchant transaction confirmation timeout", 413),

    /**
     * Merchant transaction void failed.
     */
    MERCHANT_TRANSACTION_VOID_FAILED("Merchant transaction void failed", 414),

    /**
     * Invalid customer URI.
     */
    INVALID_CUSTOMER_URI("Customer uri null", 415),

    /**
     * The device uri is not valid.
     * */
    INVALID_DEVICE_URI("Invalid device uri", 416),

    /**
     * The device type is not found
     * */
    DEVICE_TYPE_NOT_FOUND("Device type not found", 417),

    /**
     * The device is already registered.
     * */
    DEVICE_ALREADY_REGISTERED("Device is already registered", 418),

    /**
     * Authentication failed.
     */
    AUTHENTICATION_FAILED("Authentication failed", 419),

    /** Invalid partner uri. */
    INVALID_PARTNER_URI("Invalid partner uri", 420),

    /** Invalid tenant uri. */
    INVALID_TENANT_URI("Invalid tenant uri", 421),

    /** Invalid tenant uri. */
    INVALID_ISSUER_URI("Invalid issuer uri", 422),

    /**
     * The customer already exists.
     */
    CUSTOMER_ALREADY_EXISTS("Customer already exsists", 423),

    /** Invalid terminal id. */
    INVALID_TERMINAL_ID("Invalid terminal id", 424),

    /**
     * Request object is null.
     */
    REQUEST_OBJECT_NULL("Request Object is Null", 444),

    /**
     * Device already registered in the system.
     * */
    DEVICE_ALREADY_EXISTS("Device already registered in the system.", 445),

    /**
     * No transaction details found.
     * 
     */
    NO_TRANSACTION_DETAILS_FOUND("No transaction details found", 446),

    /**
     * No transaction amount details found.
     * 
     */
    NO_TRANSACTION_AMOUNT_FOUND("No transaction amount details found", 447),

    /**
     * Invalid old password provided for password update.
     * 
     */
    INVALID_PASSWORD("Invalid old password ", 448),

    /**
     * Invalid old device pin provided for device pin update.
     */
    INVALID_DEVICE_PIN("Invalid old device pin ", 449),

    /**
     * Transaction has been canceled.
     */
    TRANSACTION_CANCELED("Transaction has been canceled", 450),

    /**
     * Invalid password and device pin.
     * */
    INVALID_PASSWORD_AND_DEVICE_PIN("Invalid password and device pin.", 451),

    /**
     * Invalid fingerprint template.
     * */
    INVALID_FINGERPRINT_TEMPLATE("Invalid fingerprint template.", 452),

    /**
     * Invalid fingerprint template.
     * */
    DEVICE_NOT_FOUND("Device not found.", 453),

    /**
     * Invalid fingerprint template.
     * 
     */
    STORE_TERMINAL_ALREADY_EXISTS("Strore terminal already exists.", 454),

    /**
     * Invalid transaction status
     */
    INVALID_TRANSACTION_STATUS("Invalid transaction status", 455),

    /**
     * Transaction in use
     */
    TRANSACTION_IN_USE("Transaction in use", 456),

    /**
     * Store location not present.
     */
    STORE_TERMINAL_NOT_PRESENT("Store terminal not present", 457),

    /**
     * Store location not present.
     */
    PREDEFINED_TOKEN_NOT_FOUND("Predefined checkout token not found.", 458),

    /**
     * Merchant transaction id already exists.
     */
    MERCHANT_TRANSACTION_ID_ALREADY_EXISTS("Merchant transaction id already exists.", 459),

    /**
     * Merchant transaction not found.
     */
    MERCHANT_TRANSACTION_NOT_FOUND("Merchant transaction not found.", 460),

    /**
     * The receipt id is not valid.
     */
    INVALID_RECEIPT_ID("Invalid receipt id", 461),

    /**
     * The transaction id is not valid.
     */
    INVALID_MERCHANT_TRANSACTION_ID("Invalid transaction id", 462),

    /**
     * Merchant receipt not found.
     */
    MERCHANT_RECEIPT_NOT_FOUND("Merchant receipt not found.", 463),

    /**
     * Merchant receipt not found.
     */
    EMPTY_MERCHANT_RECEIPT_SEARCH_RESULTS("Empty merchant receipt search results.", 464),

    /**
     * Store location cannot be retrieved.
     */
    STORE_LOCATION_CANNOT_BE_RETRIEVED("Store location cannot be retrieved", 465),

    /**
     * Merchant transaction already used.
     */
    MERCHANT_TRANSACTION_ALREADY_USED("Merchant transaction already used.", 466),

    /**
     * Merchant receipt already exists.
     */
    MERCHANT_RECEIPT_ALREADY_EXISTS("Merchant receipt already exists.", 467),

    /** The customer email already exists. */
    CUSTOMER_EMAIL_ALREADY_EXSITS("Customer email address already exists", 468),

    /**
     * The Customer security profile is deactivated due to exceeding maximum number login attempts
     */
    CUSTOMER_DEACTIVATED("The Customer is deactivated due to exceeding maximum number login attempts", 495),

    /**
     * The customer password is expired
     */
    CUSTOMER_PASSWORD_EXPIRED("The customer password is expired", 602),

    /**
     * The customer password has perviously been used
     */
    CUSTOMER_PASSWORD_IS_PREVIOUSLY_USED("The customer password has perviously been used", 603);

    private final int statusCode;

    private final String displayName;

    private WSCommunicationStatus(final String displayName, final int statusCode) {
        this.statusCode = statusCode;
        this.displayName = displayName;
    }

    public int getStatusCode() {
        return this.statusCode;
    }

    public String getDisplayName() {
        return this.displayName;
    }

    public static WSCommunicationStatus valueOf(final int statusCode) {
        for (WSCommunicationStatus status : values()) {
            if (status.statusCode == statusCode) {
                return status;
            }
        }
        throw new IllegalArgumentException("No matching constant for [" + statusCode + "]");
    }

}
